package msgdef

import (
	"fmt"
)

// 申请关卡
type ApplyLevelSpaceReq struct {
	CommonMsg //Need TryInitCommonMsg(this)
	// 关卡模板ID
	LevelTID int32
	SvrID    uint64
}

func (msg *ApplyLevelSpaceReq) String() string {
	return fmt.Sprintf("%+v", *msg)
}

//////////////////////////////////////////////////////////////////////////////////////////

// ApplyLevelSpaceReq验证成功返回消息
type ApplyLevelSpaceRet struct {
	CommonMsg //Need TryInitCommonMsg(this)
	LevelTID  int32
	ErrorCode int32
	SpaceID   uint64
	Port      int32
	Addr      string
}

func (msg *ApplyLevelSpaceRet) String() string {
	return fmt.Sprintf("%+v", *msg)
}

type BattleClientVerifyReq struct {
	CommonMsg
	// PID: 玩家OBJID
	PID uint64
	// Token: 客户端登录时需要携带Token
	Token string
	// SessState: 客户端登录时需要传送当前状态
	SessState uint8
}

func (msg *BattleClientVerifyReq) GetSessVerifyPID() uint64 {
	return msg.PID
}

func (msg *BattleClientVerifyReq) GetSessState() uint8 {
	return msg.SessState
}
func (msg *BattleClientVerifyReq) GetSessSToken() string {
	return msg.Token
}

type BattleClientVerifyRet struct {
	CommonMsg
	SpaceID uint64
	IsNew   uint8
}

type PrepareLevelSpaceNTF struct {
	CommonMsg //Need TryInitCommonMsg(this)
	// 关卡模板ID
	SvrID uint64

	LevelTID  int32
	ErrorCode int32
	SpaceID   uint64
	Port      int32
	Addr      string
	MatchID   uint64
}

const LVLSpaceStopFlagOnline uint8 = 1 << 0

//关闭
type LevelSpaceStopNTF struct {
	CommonMsg
	Player map[uint64]uint8 //dbID, flags
}
